function getNewHTTPObject()
{
        var xmlhttp;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xmlhttp = false;
                  }
             }
          @else
             xmlhttp = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xmlhttp = new XMLHttpRequest();
            }
            catch (e)
            {
                xmlhttp = false;
            }
        }

        return xmlhttp;
}

var xmlHttp = getNewHTTPObject();

function getLiveScoreData(dw)
{
  /*var url = "http://70.33.254.33/getlivescore?dw="+dw;*/
  var url = "/ufone/getlivescore?dw="+dw;
  /*alert(url);*/
  xmlHttp.open('GET', url, true);
  xmlHttp.onreadystatechange = callbackFunction;
  xmlHttp.send(null);  
  setTimeout('getLiveScoreData(\''+dw+'\')', 10000);
}

function callbackFunction()
{
  if (xmlHttp.readyState != 4)
    return;

  var result = xmlHttp.responseText;
  /*alert('livescore result: '+result);*/
  document.getElementById('livescore').innerHTML=result;
  
}

function checkform ( form )
{
	var val = form.mno.value;
	if(val.length != 7) {		
		alert('please enter 7 digit number');
		form.mno.focus();
		return false;
	}
	if(isNaN(val)) {
		alert('please enter a valid number');
		form.mno.focus();
		return false;
	}
	return true;
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function animateHeader(dw, imgNum)
{
	var str = '';
	if(dw <= 240) {
		str = '-small';
	}
	
	if(imgNum == 0) {
		if (document.images)
	    {
	      preload_image_object = new Image();
	       var i = 0;
	       for(i=1; i<=4; i++) 
	         preload_image_object.src = 'images/header'+i+str+'.jpg';
	    }	
	}
	
	imgNum++;
	if(imgNum == 5) {
		imgNum=1;
	}
	/*document.getElementById('pgheader').innerHTML='<a href="index.jsp"><img src="/imgsrv?img=cricae/header'+imgNum+str+'.jpg&repo=PI&s=0&w='+dw+'" alt="" /></a>';*/
	document.getElementById('pgheader').innerHTML='<a href="index.jsp"><img src="images/header'+imgNum+str+'.jpg" width="'+dw+'" alt="" /></a>';
	setTimeout('animateHeader(\''+dw+'\',\''+imgNum+'\')', 5000);
}